Skip to content

NoFocusDelegate

Base classes

Name Children Inherits
StyledItemDelegate
prettyqt.widgets.styleditemdelegate

⋔ Inheritance diagram

graph TD
  1181604891["itemdelegates.NoFocusDelegate"]
  4109708588["widgets.StyledItemDelegate"]
  3153451512["widgets.AbstractItemDelegateMixin"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  3599391368["QtWidgets.QStyledItemDelegate"]
  475576970["QtWidgets.QAbstractItemDelegate"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  4109708588 --> 1181604891
  3153451512 --> 4109708588
  3227531497 --> 3153451512
  2751680898 --> 3227531497
  2751680898 --> 3153451512
  3599391368 --> 4109708588
  475576970 --> 3599391368
  3984060476 --> 475576970
  37984305 --> 3984060476
  2751680898 --> 37984305

🛈 DocStrings

Bases: StyledItemDelegate

Delegate to remove dotted border on cell focus.

Source code in prettyqt/itemdelegates/nofocusdelegate.py
class NoFocusDelegate(widgets.StyledItemDelegate):
    """Delegate to remove dotted border on cell focus."""

    ID = "no_focus"

    def paint(
        self,
        painter: gui.QPainter,
        option: widgets.QStyleOptionViewItem,
        index: core.ModelIndex,
    ):
        if option.state & widgets.Style.StateFlag.State_HasFocus:
            option.state = option.state ^ widgets.Style.StateFlag.State_HasFocus
        super().paint(painter, option, index)

:fa-brands-github: Show source on GitHub